package com.cloud.spring.demo.service;

import com.cloud.spring.demo.entity.User;
import com.cloud.spring.repositories.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class UserService {
    @Autowired
    UserRepository userRepository;

    public User save(User user) {
        return userRepository.save(user);
    }

    public Optional<User> findById(int id) {
        return userRepository.findById(id);
    }

    public Iterable<User> findAll() {
        return userRepository.findAll();
    }

    public Page<User> findPageByName(String name, Pageable pageable) {
        return userRepository.findPageByName(name, pageable);
    }

    public Page<User> findByFilterBuilder() {
        return null;
    }

    public Page<User> findBigResultByScanAndScroll() {
        return null;
    }

}
